package com.mjh.zhujianju.enums;

/**
 * @author: Alex
 * @version: V1.0
 * @project: zhujianju
 * @package: com.mjh.zhujianju.enums
 * @description: description
 * @date: 2018/8/25
 * @time: 下午3:41
 */
public enum AnswerTypeEnum {
	SINGLE(1,"单选题"),
	DOUBLE(2,"多选题"),
	JUDGEMENT(3,"判断题");

	private Integer code;
	private String name;

	public int getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	AnswerTypeEnum(Integer code, String name) {
		this.code = code;
		this.name = name;
	}

	public static String getName(Integer code){
		if(code == null){
			return null;
		}

		for (AnswerTypeEnum answerTypeEnum : AnswerTypeEnum.values()){
			if (code.equals(answerTypeEnum.getCode())){
				return answerTypeEnum.getName();
			}
		}

		return null;
	}
}
